package com.rongshu.utils.clickableSpan;

import android.support.annotation.ColorInt;
import android.text.TextPaint;
import android.text.style.ClickableSpan;
import android.view.View;

public class UnderLineClickSpan extends ClickableSpan {

    View.OnClickListener onClickListener;
    @ColorInt
    int color;

    public void setOnClickListener(View.OnClickListener onClickListener, int color) {
        this.onClickListener = onClickListener;
        this.color = color;
    }

    @Override
    public void onClick(View widget) {
        onClickListener.onClick(widget);
    }

    @Override
    public void updateDrawState(TextPaint ds) {
        ds.setColor(color);
        ds.setUnderlineText(false);
    }
}
